package com.fast.fastenjoy.base.web.tag;

import javax.servlet.jsp.JspException;

import com.alibaba.druid.util.StringUtils;

/**
 * 权限封装Tag
 * @author chenliaohua
 *
 */
public abstract class BaseAuthTag extends BaseTag implements AuthVerify{

	private static final long serialVersionUID = 7596210535819185830L;

	private String authCode;
	
	private String authName;
	
	@Override
	public int doStartTag() throws JspException{
		
		if(authorized()){
			
			doInitParam();
			
			doTag();
			
			return EVAL_BODY_AGAIN;
		}
		
		return SKIP_BODY;
	}
	
	public boolean authorized() {
		
		if(StringUtils.isEmpty(authCode)){
			
			return true;
		}
		
		// TODO 权限认证
		
		return true;
	}
	
	public String getAuthName() {
		return authName;
	}

	public void setAuthName(String authName) {
		this.authName = authName;
	}

	public String getAuthCode() {
		return authCode;
	}

	public void setAuthCode(String authCode) {
		this.authCode = authCode;
	}

}
